| Cloth% - мягкое тело coef# - коэффициент |
| Устанавливает коэффициент жесткости тела. |
|
;Пример использования функций ;pxCreateCloth Graphics3D 800,600,32,2 SetBuffer BackBuffer() ;Создаем свет light01=CreateLight() PositionEntity light01,0,60,-15 RotateEntity light01,30,0,0 AmbientLight 255,255,255 ;Создаем плоскость plane=CreatePlane() EntityColor plane,100,200,100 EntityAlpha plane, 0.5 m=CreateMirror() ;и камеру cam=CreateCamera() PositionEntity cam,0,14,-18 RotateEntity cam,30,0,0 cloth_mesh = LoadMesh("media\Box.x") ScaleMesh cloth_mesh,.4,.4,.4 surf = GetSurface(cloth_mesh, 1) PositionEntity cloth_mesh, 0, 15, 0 EntityFX cloth_mesh,16 tex=LoadTexture ("media\cell.bmp") ScaleTexture tex, .1,.1 EntityTexture cloth_mesh, tex EntityShininess cloth_mesh, 1 ;PX PxCreateWorld(1) pxSetGravity(0,-10,0) cube_body=PxCreateCube(3,3,3, 50) pxSetPosition(cube_body, 0,5,2.5) cube_mesh=CreateCube() ScaleEntity cube_mesh,3,3,3 EntityColor cube_mesh,255,0,255 ;PositionEntity cube_mesh,0,3,2.5 ;Превращаем меш в мягкое тело cloth_body = pxCreateCloth(cloth_mesh, surf) ;Создаем давление в теле ;pxClothSetPressure(cloth_body, 3) ; ---------- Применяем pxCreateCloth ;задаем прочность телу pxClothSetComDampingCoefficient(cloth_body, 2) Repeat VertexCoords surf,0, 0,0,0 ; MeshHeight(cloth_mesh) UpdateNormals cloth_mesh ; Обновим все мягкие тела pxUpdateCloth() RenderPhysic(60,0) ; обновим кубик pxSetEntity cube_mesh,cube_body If KeyHit(2)=True Then enable=1-enable WireFrame enable UpdateWorld() RenderWorld() Flip Until KeyHit(1) End |
К содержанию
Нажмите здесь чтобы увидеть последнюю версию этой странички в режиме online.